<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "ql_user_tiktok_product_goods".
 *
 * @property int $id
 * @property int $user_id 商家ID
 * @property int $company_id 公司id
 * @property string $name 产品名称
 * @property float $price 价格
 * @property float $min_price 最低价格
 * @property float $max_price 最高价格
 * @property float $creator_commission_percent 达人佣金比例
 * @property float $seller_commission_percent 商家提供的佣金比例
 * @property string $product_id tk的产品id
 * @property float $product_rating 星级
 * @property int $product_review_count 评论
 * @property int $product_sales 出售数
 * @property string $seller_id tk卖家id
 * @property string $shop_code tk店铺编号
 * @property string $sample_quota 样品数量
 * @property string|null $content 产品描述
 * @property string|null $img 图片
 * @property string|null $link 链接
 * @property string|null $product_link 产品链接
 * @property string|null $data 采集的Json数据
 * @property string $created_at
 * @property int $type 0普通板块，1 seller板块
 */
class QlUserTiktokProductGoods extends \yii\db\ActiveRecord
{
    const GOODS = 0;
    const SELLER = 1;
    const EXCLUSIVE = 3;

    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return 'ql_user_tiktok_product_goods';
    }

    /**
     * @return \yii\db\Connection the database connection used by this AR class.
     */
    public static function getDb()
    {
        return Yii::$app->get('db_vikoc');
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['user_id', 'name'], 'required'],
            [['user_id', 'company_id', 'product_review_count', 'product_sales', 'type'], 'integer'],
            [['name', 'content', 'img', 'link', 'product_link', 'data'], 'string'],
            [['price', 'min_price', 'max_price', 'creator_commission_percent', 'seller_commission_percent', 'product_rating'], 'number'],
            [['created_at'], 'safe'],
            [['product_id', 'seller_id', 'shop_code', 'sample_quota'], 'string', 'max' => 50],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => Yii::t('app', 'ID'),
            'user_id' => Yii::t('app', '商家ID'),
            'company_id' => Yii::t('app', '公司id'),
            'name' => Yii::t('app', '产品名称'),
            'price' => Yii::t('app', '价格'),
            'min_price' => Yii::t('app', '最低价格'),
            'max_price' => Yii::t('app', '最高价格'),
            'creator_commission_percent' => Yii::t('app', '达人佣金比例'),
            'seller_commission_percent' => Yii::t('app', '商家提供的佣金比例'),
            'product_id' => Yii::t('app', 'tk的产品id'),
            'product_rating' => Yii::t('app', '星级'),
            'product_review_count' => Yii::t('app', '评论'),
            'product_sales' => Yii::t('app', '出售数'),
            'seller_id' => Yii::t('app', 'tk卖家id'),
            'shop_code' => Yii::t('app', 'tk店铺编号'),
            'sample_quota' => Yii::t('app', '样品数量'),
            'content' => Yii::t('app', '产品描述'),
            'img' => Yii::t('app', '图片'),
            'link' => Yii::t('app', '链接'),
            'product_link' => Yii::t('app', '产品链接'),
            'data' => Yii::t('app', '采集的Json数据'),
            'created_at' => Yii::t('app', 'Created At'),
            'type' => Yii::t('app', '0普通板块，1 seller板块'),
        ];
    }
}
